# !/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Time        : 2021/9/17 16:16
@Author      : Albert Darren
@Contact     : 2563491540@qq.com
@File        : opencv_upsample.py
@Version     : Version 1.0.0
@Description : TODO
@Created By  : PyCharm
"""
import cv2 as cv
from matplotlib import pyplot as plt

im = cv.imread('./../experiment_fig/interpolation.png')
rows, columns, _ = im.shape
# 使用三种插值方法上采样
inter_methods = {"INTER_LINEAR": cv.INTER_LINEAR,
                 "INTER_CUBIC": cv.INTER_CUBIC,
                 "INTER_NEAREST": cv.INTER_NEAREST}
keys = inter_methods.keys()
index = 1
for inter_method in inter_methods:
    plt.subplot(1, 3, index)
    plt.title(inter_method)
    up_sample_im = cv.resize(im, dsize=(rows * 5, columns * 5),
                             interpolation=inter_methods[inter_method])
    plt.imshow(up_sample_im, cmap="gray")
    index += 1
plt.show()
